home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / Library & Plugs / Plug-Ins Dev 68K / Maximize.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-01  |  1016 b   |  55 lines  |  [TEXT/KAHL]

  1. /*    Player PRO 4.11 PlugIns
  2.  
  3.     Antoine ROSSET
  4.     16 Tranchees
  5.     1206 GENEVA
  6.     SWITZERLAND
  7.     
  8.     FAX: 022 789 35 03
  9.     Compuserve: 100277,164
  10. */
  11.  
  12. /*****************************************************/
  13.  
  14. /*     This is an exemple of Player PRO's PlugIns.
  15.     Compiling: 'PLug', ID = 1000
  16.     STR# ID 1000: Menu Name
  17.     
  18.     If you want to reallocate InstrumentPtr:
  19.     
  20.     DisposPtr( InstrumentPtr);            // VERY IMPORTANT
  21.     
  22.     InstrumentPtr = NewPtr( newsize);    // Use NewPtr ONLY !
  23. */
  24.  
  25. /********************************************************/
  26.  
  27. #include "MAD.h"
  28.  
  29. OSErr main(     Ptr                        *InstrumentPtr,
  30.                 struct FileInstrData    *theData,
  31.                 long                    SelectionStart,
  32.                 long                    SelectionEnd)
  33. {
  34. long    i;
  35. int        temp;
  36. Ptr        SamplePtr = *InstrumentPtr;
  37.  
  38.     SamplePtr += SelectionStart;
  39.     
  40.     for( i = 0; i < SelectionEnd - SelectionStart; i++)
  41.     {
  42.         temp = *SamplePtr;
  43.         if( temp >= 0x80) temp -= 0xFF;
  44.             
  45.         temp *= 5;
  46.         temp /= 4;
  47.         if( temp >= 127) temp = 127;
  48.         else if( temp <= -127 ) temp = -127;
  49.             
  50.         *SamplePtr = temp;
  51.         SamplePtr++;
  52.     }
  53.     
  54.     return noErr;
  55. }